import Redis from 'ioredis';
const redis = new Redis();
// 生产者：将消息推送到队列
async function produceMessage(queueName:string, message:string) {
    try {
        await redis.rpush(queueName, message);
        console.log(`Produced message: ${message}`);
    } catch (error) {
        console.error('Error producing message:', error);
    }
}
// 例子
const queueName = 'myQueue';
for (let i = 0; i < 100; i++) {

// 生产者推送消息到队列
    produceMessage(queueName, 'Hello, World!' +
        i);
}
